package com.waves.core.utils;

import com.waves.core.handle.TokenInterceptor;
import com.waves.core.web.domain.entities.User;

import java.util.Optional;

public class LoginUtils {

    /**
     * 获取用户信息
     * @return
     */
    public static User getUser() {
        return TokenInterceptor.userInfo.get();
    }

    public static String getIp() {
        return getUser().getIpInfo().getUpdateIp();
    }

    /**
     * 获取用户id
     * @return
     */
    public static Long getUserId() {
        return getUser().getId();
    }

}
